<template>
  <div class="sellbook-box">
    <h2 class="sellbook-h2" v-for="sellbooks in sellbook" :key="sellbooks.id">
      <li>
        <img :src="sellbooks.url" />
        <p>
          <span>{{ sellbooks.name }}</span>
          <span>
            <em>{{ sellbooks.wenzi2 }}</em>
          </span>
        </p>
      </li>
      </h2>
    <h3 class="sellbook-h3">
      <span>了解卖书规则</span>
      <span>
        <i class="iconfont icon-24gl-arrowRight2"></i>
      </span>
    </h3>
    <h4 class="sell-h4">
      <p>
        <i class="iconfont icon-fenxiang_2"></i>
        <span>扫码卖书</span>
      </p>
      <p>手动输入ISBN</p>
    </h4>
  </div>
</template>
<script>
export default {
  name: "Sellbook",
  data() {
    return {
      sellbook: [],
    };
  },
  created() {
    let xhr = new XMLHttpRequest();
    xhr.open("get", "http://localhost:3000/sellbook", true);
    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4 && xhr.status == 200) {
        console.log(JSON.parse(xhr.responseText));
        this.sellbook = JSON.parse(xhr.responseText);
     
      }
    };
    xhr.send();
  },
};
</script>
<style scoped>
.sellbook-box .sellbook-h2 li {
  height: 1.4rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-bottom: 1px solid #999;
}
.sellbook-box .sellbook-h2 li img {
  width: 1.3rem;
  height: 1.1rem;
}
.sellbook-box .sellbook-h2 li p {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  width: 1.1rem;
}
.sellbook-box .sellbook-h2 li p span:nth-child(2) {
  font-size: 16px;
  color: rgb(81, 136, 22);
  padding-top: 0.1rem;
}
.sellbook-box .sellbook-h2 li p .iconfont {
  font-weight: 700;
}
.sellbook-h3 {
  padding: 0 0.1rem;
  font-size: 20px;
  height: 0.4rem;
  border-bottom: 0.01rem solid #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sellbook-h3 .iconfont {
  font-weight: 700;
  font-size: 26px;
}
.sell-h4 {
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  background-color: #fff;
  height: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.sell-h4 p:nth-child(1) {
  width: 1.95rem;
  height: 0.55rem;
  text-align: center;
  line-height: 0.55rem;
  border-radius: 0.3rem;
  background-color: rgb(74, 118, 76);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}
.sell-h4 .iconfont {
  font-size: 28px;
  font-weight: 400;
  padding-right: 0.1rem;
}
.sell-h4 p:nth-child(2) {
  font-size: 14px;
  color: #999;
}
</style>